﻿using Abp.Web.Models;
using Microsoft.AspNetCore.Mvc.ModelBinding;

namespace Batman.Cms.Core.Models.Mvc
{
    public class ResponseBase : AjaxResponse
    {
        public ResponseBase(bool success) : base()
        {
        }

        public ResponseBase(bool success, string error) : base()
        {
            this.Success = success;
            this.Error = new ErrorInfo(error);
        }

        public void AddModelError(ModelStateDictionary ModelState)
        {
            ModelState.AddModelError(string.Empty, this.Error.Message);
        }
    }
}
